import datetime

import yaml

data = {
    'date':datetime.date(2025,10,10),
    'name':'Hogwarts',
    'test1':[123,234,232],
    'test2':[{
              'name':'zhangsan',
              'age':21,
              },
             {
              'name':'lisi',
              'age':23
             }]
}
with open('output.yaml','w') as file:
    yaml.safe_dump(data,file)


with open('output.yaml','r') as f:
    f = yaml.safe_load(f)
    print(f)